<!--
 * @Author Malred · Wang
 * @Date 2025-06-17 13:29:54
 * @Description 
 * @Path src/components/base/operation/date.vue
 -->
<!-- operation-date.vue -->
<template>
  <el-form-item :label="label">
    <el-date-picker
        v-model="selectedDate"
        type="date"
        placeholder="选择日期"
        value-format="YYYY-MM-DD"
    />
  </el-form-item>
</template>

<script setup>
import { defineProps, defineEmits, ref, watch } from 'vue';

const props = defineProps({
  label: String,
  value: String
});

const emit = defineEmits(['update:value']);

const selectedDate = ref(props.value);

// 监听日期变化并通知父组件
watch(selectedDate, (newVal) => {
  emit('update:value', newVal);
});
</script>
